package com.monitor.app_monitor.controller;

import com.monitor.app_monitor.entity.ResultInfo;
import com.monitor.app_monitor.entity.Webhook;
import com.monitor.app_monitor.service.TaskService;
import com.monitor.app_monitor.vo.EmsListVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;



@CrossOrigin
@Slf4j
@RestController
@RequestMapping(method = RequestMethod.GET,path = "/ems")
public class EmsController {
    @Autowired
    private TaskService taskService;

    @GetMapping("/get-emsList")
    private ResultInfo<?> getEmsList() {
        List<EmsListVo> emsListVos = taskService.emsList();
        return ResultInfo.ok(emsListVos);
    }

    @GetMapping("/add-ems")
    private ResultInfo<?> addEms(@RequestParam String emsName,@RequestParam String resType) {
        String ddd = taskService.emsAdd(emsName, resType);
        return ResultInfo.ok(ddd);
    }

    @GetMapping("/del-ems")
    private ResultInfo<?> delEms(@RequestParam String emsName,@RequestParam String resType) {
        String ddd = taskService.emsdel(emsName, resType);
        return ResultInfo.ok(ddd);
    }

    @GetMapping("/get-yg-file")
    private ResultInfo<?> getYgFile() {
        String ddd = taskService.getYgFile();
        return ResultInfo.ok(ddd);
    }

}
